/* eslint-disable @typescript-eslint/no-explicit-any */
import { withInstall } from '@ibiz-template/vue3-util';
import { ControlType, registerControlProvider } from '@ibiz-template/runtime';
import { PivotTable } from './pivottable';
import { PivotTableProvider } from './pivottable.provider';
import { GroupPivotTableBody } from './components/group-pivottable-body/group-pivottable-body';
import './pivottable/styles/vue-pivottable.css';

export const IBizPivotTable = withInstall(PivotTable, (v: any) => {
  v.component(PivotTable.name, PivotTable);
  v.component(GroupPivotTableBody.name, GroupPivotTableBody);
  registerControlProvider(
    `${ControlType.GRID}_PIVOTTABLE`,
    () => new PivotTableProvider(),
  );
});

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: any) {
    app.use(IBizPivotTable);
  },
};
